package com.etlmaster.executor.utils;

import javax.sql.DataSource;

import com.etlmaster.core.BeanFactory;
import com.etlmaster.core.DataSourceHolder;

/**
 * @author Larry
 * @copyright Larry@etlMaster
 * @since 2017-09-10
 */
public class MultiTenantDataSourceUtils {
	public static DataSource getDataSource(String datasourceName, String username,String password){
		if(username!=null && username.length()>0){
			return DataSourceHolder.getInstance().getDataSource(datasourceName, username, password);
		}else{
			return (DataSource)BeanFactory.getBean(datasourceName);
		}
	}
}
